using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Bullet : MonoBehaviour
{
    private Vector3 dir;

    public float speed;

    public float AliveTime;

    private Map map;

    public void SetTarget(Vector3 dir) 
    {
        map = GameObject.FindObjectOfType<Map>();
        this.dir = dir;
        Destroy(gameObject, AliveTime);
    }

    // Update is called once per frame
    void Update()
    {
        transform.Translate(dir.normalized * speed * Time.deltaTime);
    }

    //private void OnTriggerEnter2D(Collider2D collision)
    //{
    //    switch (collision.tag) 
    //    {
    //        case "Mouse":
    //            Destroy(collision.gameObject);
    //            map.CreateMouse(1);
    //            Destroy(gameObject);
    //            break;
    //    }
    //}

}
